package com.example.springbootmybatis.controller;

import com.example.springbootmybatis.bean.User;
import com.example.springbootmybatis.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    private UserMapper userMapper;

    @GetMapping("/selectAll")
    public List<User> selectAll(){
        List<User> userList = userMapper.selectAll();
        for (User u : userList ) {
            System.out.println(u.getName());
        }
        return userList;
    }
}
